import sqlite3
import time

"""
创建程序所用的数据库
"""

SQL_NAME = '19326240005-刘正义-数字媒体基础春季班-动画信息管理系统.db'


def display():
    print('''
    --------------- 正义VideoSite后端数据库生成程序 ------------------
    正在生成...................................................''', end='')
    generate()
    print('[ok]')


def generate():
    conn = sqlite3.connect(SQL_NAME)
    c = conn.cursor()
    c.execute('''
    CREATE TABLE ANIMATE(
    ID INT PRIMARY KEY NOT NULL ,
    AID INT NOT NULL ,
    NAME TEXT NOT NULL ,
    GENRES TEXT ,
    PEOPLE TEXT ,
    OVERVIEW TEXT
    )
    ''')
    c.execute('''
    CREATE TABLE SEASON(
    ID INT NOT NULL ,
    AID INT NOT NULL ,
    NAME TEXT NOT NULL ,
    SEASON INT NOT NULL ,
    SEASON_YEAR INT ,
    EP_LEN INT
    )
    ''')
    c.execute('''
    CREATE TABLE EPISODE(
    ID INT NOT NULL ,
    AID INT NOT NULL ,
    SEASON INT NOT NULL ,
    EPISODE INT NOT NULL ,
    TITLE TEXT ,
    INFO TEXT 
    )
    ''')
    conn.commit()
    conn.close()


if __name__ == '__main__':
    display()
